import type { Equal } from "@type-challenges/utils";

// 数字加1
type Add1<T extends number, R extends number[] = []> = R["length"] extends T
  ? [...R, any]["length"]
  : AddOne<T, [...R, any]>;

type NumberRange<
  L extends number,
  H extends number,
  Result extends unknown[] = []
> = L extends H
  ? [...Result, L] // [number]
  : NumberRange<Add1<L>, H, [...Result, L]>;

type ArrtoUnion<T extends any[]> = T[number];

type NR = ArrtoUnion<NumberRange<2, 9>>;
